<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="/h/sougou/http://img1.kf.sogou.com"/>
<link rel="dns-prefetch" href="/h/sougou/http://file.kf.sogou.com"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<meta property="qc:admins" content="3607543040377756375"/>
<link rel="shortcut icon" type="image/x-icon" href="/h/sougou//favicon32.ico" media="screen"/>
<link href="/h/sougou/css/style.css" type="text/css" rel="stylesheet"/>
<script src="/h/sougou/js/jquery-2.2.4.min.js"></script>
<title>反馈中心</title>
</head>
<body class="container">
<div class="header">
	<div class="headerin">
		<img src="/h/sougou/picture/logo.png">
		<div class="page-header">
			<h2>知也 <small>|反馈中心</small></h2>
		</div>
	</div>
</div>
<div class="wrap">
	<div class="wrapin">
		<div class="wrapintext">
			<div id="all-forms">
				<form action="/home/suggest" method="post" enctype="multipart/form-data" id="myform">
					{{csrf_field()}}
					<div class="field-container">
						<div class="field-title">
							标题 <span>* (请简单写入您反馈的标题，30个汉字以内) </span>：
						</div><br>
						<textarea name="s_title" cols="73" rows="3" style="resize: none;" data-valid-required="true" data-valid-required-msg="*请填写标题" data-valid-max-len="30" data-valid-max-len-msg="*最多可填写30字" data-valid-regex-msg="*请输入汉字描述"></textarea>
					</div>
					<div class="field-container">
						<div class="field-title">
							描述 <span>* (请您详细说明遇到的情况和申请原因，500个汉字以内) </span>：
						</div>
						<textarea class="field" name="s_content" data-valid-required="true" data-valid-required-msg="*请填写描述" data-valid-max-len="500" data-valid-max-len-msg="*最多可填写500字" data-valid-regex="[一-龥]+" data-valid-regex-msg="*请输入汉字描述"></textarea>
					</div>
					<div class="control-group success">
					    <label class="control-label" for="fileInput">文件上传</label>
					    <div class="controls">
					        <div class="uploader" id="uniform-fileInput">
					            <input class="input-file uniform_on" id="pic" name="pic" type="file">
					        </div>
					        <div style="margin-top:10px;">
					        	<p><img id="imgs" alt="上传后显示图片"  style="max-width:350px;max-height:100px;" /></p>
					        	<input type="hidden" name="s_pic" id="s_pic">
					        </div>
					    </div>
					</div>
					<div class="button">
						<input value="提 交" type="submit" style="cursor: pointer"/>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<div class="footer">
	<p class="s_copyright">
		©
		<script>document.write(new Date().getFullYear())</script>
		ZHIYE - 京ICP证050897号
	</p>
</div>

<script src="/h/sougou/js/jquery.form.min.js"></script>
<script src="/h/sougou/js/jquery.blockui.min.js"></script>
<script src="/h/sougou/js/bundle.js"></script>
<script>
		// var logo=document.getElementById('web_logo');
        // logo.onchange=function(){
        // 	showpic();
        // }

         $(function () {
            $("#pic").change(function () {
                showpic();
                
            });
        });
   
		function showpic()
		{
			//判断是否有选择上传文件
            var imgPath = $("#pic").val();
            if (imgPath == "") {
                alert("请选择上传图片！");
                return;
            }
            //判断上传文件的后缀名
            var strExtension = imgPath.substr(imgPath.lastIndexOf('.') + 1);
            if (strExtension != 'jpg' && strExtension != 'gif'
                && strExtension != 'png' && strExtension != 'bmp' && strExtension != 'JPG') {
                alert("请上传正确的图片文件类型");
                return;
            }
            //获取表单的值上传文件的
             var formData = new FormData($('#myform')[0]);
            $.ajax({
                type: "POST",
                url: "/home/upload",
                data: formData,
                async: true,
                cache: false,
                contentType: false,
                processData: false,
                success: function(data) {

                    $('#imgs').attr('src',data);
                    $('#s_pic').val(data);


                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert("上传失败，请检查网络后重试");
                }
            });
		}

</script>
</body>
</html>